package kgc.crm.controller;

import kgc.crm.annotation.VerificationToken;
import kgc.crm.enums.TimeTypeEnum;
import kgc.crm.mapper.CustomerMapper;
import kgc.crm.service.IIndexService;
import kgc.crm.util.CommonResult;
import kgc.crm.vo.IndexSalesKitVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("index")
@CrossOrigin
public class IndexController {

    @Autowired
    private IIndexService indexService;

    @VerificationToken //验证token
    @GetMapping("sales/kit/{time}/{type}")
    public ResponseEntity<CommonResult<IndexSalesKitVo>> salesKit(
            @PathVariable("time") TimeTypeEnum timeType
             ,@PathVariable("type") Integer type) {
        //body响应的内容，后面是状态
        IndexSalesKitVo vo = indexService.salesKit(timeType.getValue(), type);
        return  new ResponseEntity<CommonResult<IndexSalesKitVo>>(new CommonResult<>(200,"成功",vo),HttpStatus.OK);
    }
}
